package org.example.service;

import org.example.dao.OrderDAO;
import org.example.dao.OrderDAOImpl;
import org.example.model.Order;
import org.json.JSONArray;
import java.util.List;

public class OrderServiceImpl implements OrderService {
    private OrderDAO orderDAO = new OrderDAOImpl();

    @Override
    public List<Order> getOrdersByUserId(Integer userId) {
        return orderDAO.findByUserId(userId);
    }

    @Override
    public Order getOrderByNumber(String orderNumber) {
        return orderDAO.findByOrderNumber(orderNumber);
    }

    @Override
    public boolean updateOrderStatus(String orderNumber, String status) {
        return orderDAO.updateOrderStatus(orderNumber, status);
    }

    @Override
    public boolean createOrder(Order order, JSONArray items) {
        return orderDAO.createOrderWithItems(order, items);
    }

    @Override
    public boolean deleteOrder(Integer orderId) {
        return orderDAO.delete(orderId);
    }
} 